@@ -1478,6 +1478,9 @@ void main() {
1478
1478
});
1479
1479
1480
1480
group ('incremental builds with cached graph' , () {
1481
+ // Using `resumeFrom: result` to pass the filesystem between builds causes
1482
+ // the serialized graph to be loaded.
1483
+
1481
1484
test ('one new asset, one modified asset, one unchanged asset' , () async {
1482
1485
var builders = [copyABuilderApplication];
1483
1486
@@ -1489,9 +1492,6 @@ void main() {
1489
1492
);
1490
1493
1491
1494
// Followup build with modified inputs.
1492
- var serializedGraph = result.readerWriter.testing.readBytes (
1493
- makeAssetId ('a|$assetGraphPath ' ),
1494
- );
1495
1495
await testBuilders (
1496
1496
builders,
1497
1497
{
@@ -1500,7 +1500,6 @@ void main() {
1500
1500
'a|lib/b.txt' : 'b' ,
1501
1501
'a|lib/b.txt.copy' : 'b' ,
1502
1502
'a|lib/c.txt' : 'c' ,
1503
- 'a|$assetGraphPath ' : serializedGraph,
1504
1503
},
1505
1504
outputs: {'a|web/a.txt.copy' : 'a2' , 'a|lib/c.txt.copy' : 'c' },
1506
1505
resumeFrom: result,
@@ -1528,17 +1527,10 @@ void main() {
1528
1527
);
1529
1528
1530
1529
// Followup build with the 2nd output missing.
1531
- var serializedGraph = result.readerWriter.testing.readBytes (
1532
- makeAssetId ('a|$assetGraphPath ' ),
1533
- );
1534
1530
result.readerWriter.testing.delete (AssetId ('a' , 'lib/a.txt.2' ));
1535
1531
await testBuilders (
1536
1532
builders,
1537
- {
1538
- 'a|lib/a.txt' : 'a' ,
1539
- 'a|lib/a.txt.1' : 'a' ,
1540
- 'a|$assetGraphPath ' : serializedGraph,
1541
- },
1533
+ {'a|lib/a.txt' : 'a' , 'a|lib/a.txt.1' : 'a' },
1542
1534
outputs: {'a|lib/a.txt.1' : 'a' , 'a|lib/a.txt.2' : 'a' },
1543
1535
resumeFrom: result,
1544
1536
);
@@ -1581,51 +1573,39 @@ void main() {
1581
1573
);
1582
1574
1583
1575
// Followup build with modified unused inputs should have no outputs.
1584
- var serializedGraph = result.readerWriter.testing.readBytes (
1585
- makeAssetId ('a|$assetGraphPath ' ),
1586
- );
1587
1576
await testBuilders (
1588
1577
builders,
1589
1578
{
1590
1579
'a|lib/a.txt' : 'a' ,
1591
1580
'a|lib/a.txt.used' : 'b' ,
1592
1581
'a|lib/a.txt.unused' : 'd' , // changed the content of this one
1593
1582
'a|lib/a.txt.copy' : 'ab' ,
1594
- 'a|$assetGraphPath ' : serializedGraph,
1595
1583
},
1596
1584
outputs: {},
1597
1585
resumeFrom: result,
1598
1586
);
1599
1587
1600
1588
// And now modify a real input.
1601
- serializedGraph = result.readerWriter.testing.readBytes (
1602
- makeAssetId ('a|$assetGraphPath ' ),
1603
- );
1604
1589
await testBuilders (
1605
1590
builders,
1606
1591
{
1607
1592
'a|lib/a.txt' : 'a' ,
1608
1593
'a|lib/a.txt.used' : 'e' ,
1609
1594
'a|lib/a.txt.unused' : 'd' ,
1610
1595
'a|lib/a.txt.copy' : 'ab' ,
1611
- 'a|$assetGraphPath ' : serializedGraph,
1612
1596
},
1613
1597
outputs: {'a|lib/a.txt.copy' : 'ae' },
1614
1598
resumeFrom: result,
1615
1599
);
1616
1600
1617
1601
// Finally modify the primary input.
1618
- serializedGraph = result.readerWriter.testing.readBytes (
1619
- makeAssetId ('a|$assetGraphPath ' ),
1620
- );
1621
1602
await testBuilders (
1622
1603
builders,
1623
1604
{
1624
1605
'a|lib/a.txt' : 'f' ,
1625
1606
'a|lib/a.txt.used' : 'e' ,
1626
1607
'a|lib/a.txt.unused' : 'd' ,
1627
1608
'a|lib/a.txt.copy' : 'ae' ,
1628
- 'a|$assetGraphPath ' : serializedGraph,
1629
1609
},
1630
1610
outputs: {'a|lib/a.txt.copy' : 'fe' },
1631
1611
resumeFrom: result,
@@ -1653,32 +1633,20 @@ void main() {
1653
1633
);
1654
1634
1655
1635
// Followup build with modified primary input should have no outputs.
1656
- var serializedGraph = result.readerWriter.testing.readBytes (
1657
- makeAssetId ('a|$assetGraphPath ' ),
1658
- );
1659
1636
await testBuilders (
1660
1637
builders,
1661
- {
1662
- 'a|lib/a.txt' : 'b' ,
1663
- 'a|lib/a.txt.used' : '' ,
1664
- 'a|lib/a.txt.copy' : 'a' ,
1665
- 'a|$assetGraphPath ' : serializedGraph,
1666
- },
1638
+ {'a|lib/a.txt' : 'b' , 'a|lib/a.txt.used' : '' , 'a|lib/a.txt.copy' : 'a' },
1667
1639
outputs: {},
1668
1640
resumeFrom: result,
1669
1641
);
1670
1642
1671
1643
// But modifying other inputs still causes a rebuild.
1672
- serializedGraph = result.readerWriter.testing.readBytes (
1673
- makeAssetId ('a|$assetGraphPath ' ),
1674
- );
1675
1644
await testBuilders (
1676
1645
builders,
1677
1646
{
1678
1647
'a|lib/a.txt' : 'b' ,
1679
1648
'a|lib/a.txt.used' : 'b' ,
1680
1649
'a|lib/a.txt.copy' : 'a' ,
1681
- 'a|$assetGraphPath ' : serializedGraph,
1682
1650
},
1683
1651
outputs: {'a|lib/a.txt.copy' : 'b' },
1684
1652
resumeFrom: result,
@@ -1706,13 +1674,10 @@ void main() {
1706
1674
);
1707
1675
1708
1676
// Delete the primary input, the output shoud still be deleted
1709
- var serializedGraph = result.readerWriter.testing.readBytes (
1710
- makeAssetId ('a|$assetGraphPath ' ),
1711
- );
1712
1677
result.readerWriter.testing.delete (AssetId ('a' , 'lib/a.txt' ));
1713
1678
await testBuilders (
1714
1679
builders,
1715
- {'a|lib/a.txt.copy' : 'a' , 'a|$ assetGraphPath ' : serializedGraph },
1680
+ {'a|lib/a.txt.copy' : 'a' },
1716
1681
outputs: {},
1717
1682
resumeFrom: result,
1718
1683
);
@@ -1743,17 +1708,10 @@ void main() {
1743
1708
);
1744
1709
1745
1710
// Followup build with deleted input + cached graph.
1746
- var serializedGraph = result.readerWriter.testing.readBytes (
1747
- makeAssetId ('a|$assetGraphPath ' ),
1748
- );
1749
1711
result.readerWriter.testing.delete (AssetId ('a' , 'lib/a.txt' ));
1750
1712
await testBuilders (
1751
1713
builders,
1752
- {
1753
- 'a|lib/a.txt.copy' : 'a' ,
1754
- 'a|lib/a.txt.clone' : 'a' ,
1755
- 'a|$assetGraphPath ' : serializedGraph,
1756
- },
1714
+ {'a|lib/a.txt.copy' : 'a' , 'a|lib/a.txt.clone' : 'a' },
1757
1715
outputs: {},
1758
1716
resumeFrom: result,
1759
1717
);
@@ -1784,14 +1742,7 @@ void main() {
1784
1742
);
1785
1743
1786
1744
// Followup build with same sources + cached graph.
1787
- var serializedGraph = result.readerWriter.testing.readBytes (
1788
- makeAssetId ('a|$assetGraphPath ' ),
1789
- );
1790
- await testBuilders (builders, {
1791
- 'a|web/a.txt' : 'a' ,
1792
- 'a|web/a.txt.copy' : 'a' ,
1793
- 'a|$assetGraphPath ' : serializedGraph,
1794
- }, outputs: {});
1745
+ await testBuilders (builders, {}, outputs: {}, resumeFrom: result);
1795
1746
});
1796
1747
1797
1748
test ('no outputs if no changed sources using `hideOutput: true`' , () async {
@@ -1809,14 +1760,7 @@ void main() {
1809
1760
);
1810
1761
1811
1762
// Followup build with same sources + cached graph.
1812
- var serializedGraph = result.readerWriter.testing.readBytes (
1813
- makeAssetId ('a|$assetGraphPath ' ),
1814
- );
1815
- await testBuilders (builders, {
1816
- 'a|web/a.txt' : 'a' ,
1817
- 'a|web/a.txt.copy' : 'a' ,
1818
- 'a|$assetGraphPath ' : serializedGraph,
1819
- }, outputs: {});
1763
+ await testBuilders (builders, {}, outputs: {}, resumeFrom: result);
1820
1764
});
1821
1765
1822
1766
test ('inputs/outputs are updated if they change' , () async {
@@ -1836,10 +1780,6 @@ void main() {
1836
1780
1837
1781
// Followup build with same sources + cached graph, but configure the
1838
1782
// builder to read a different file.
1839
- var serializedGraph = result.readerWriter.testing.readBytes (
1840
- makeAssetId ('a|$assetGraphPath ' ),
1841
- );
1842
-
1843
1783
await testBuilders (
1844
1784
[
1845
1785
applyToRoot (
@@ -1856,7 +1796,6 @@ void main() {
1856
1796
// builder but pretending its the same.
1857
1797
'a|lib/file.b' : 'b2' ,
1858
1798
'a|lib/file.c' : 'c' ,
1859
- 'a|$assetGraphPath ' : serializedGraph,
1860
1799
},
1861
1800
outputs: {'a|lib/file.a.copy' : 'c' },
1862
1801
resumeFrom: result,
@@ -1901,17 +1840,13 @@ void main() {
1901
1840
1902
1841
// Modify the primary input of `file.a.copy`, but its output doesn't
1903
1842
// change so `file.a.copy.copy` shouldn't be rebuilt.
1904
- var serializedGraph = result.readerWriter.testing.readBytes (
1905
- makeAssetId ('a|$assetGraphPath ' ),
1906
- );
1907
1843
await testBuilders (
1908
1844
builders,
1909
1845
{
1910
1846
'a|lib/file.a' : 'a2' ,
1911
1847
'a|lib/file.b' : 'b' ,
1912
1848
'a|lib/file.a.copy' : 'b' ,
1913
1849
'a|lib/file.a.copy.copy' : 'b' ,
1914
- 'a|$assetGraphPath ' : serializedGraph,
1915
1850
},
1916
1851
outputs: {'a|lib/file.a.copy' : 'b' },
1917
1852
resumeFrom: result,
@@ -1922,22 +1857,24 @@ void main() {
1922
1857
var builders = [applyToRoot (SiblingCopyBuilder ())];
1923
1858
1924
1859
// Initial build.
1925
- final result = await testBuilders (
1860
+ var result = await testBuilders (
1926
1861
builders,
1927
1862
{'a|web/a.txt' : 'a' , 'a|web/a.txt.sibling' : 'sibling' },
1928
1863
outputs: {'a|web/a.txt.new' : 'sibling' },
1929
1864
);
1930
1865
1931
1866
// Followup build with cached graph and a changed primary input, but the
1932
1867
// actual file that was read has not changed.
1933
- await testBuilders (builders, {
1934
- 'a|web/a.txt' : 'b' ,
1935
- 'a|web/a.txt.sibling' : 'sibling' ,
1936
- 'a|web/a.txt.new' : 'sibling' ,
1937
- 'a|$assetGraphPath ' : result.readerWriter.testing.readBytes (
1938
- makeAssetId ('a|$assetGraphPath ' ),
1939
- ),
1940
- }, outputs: {});
1868
+ result = await testBuilders (
1869
+ builders,
1870
+ {
1871
+ 'a|web/a.txt' : 'b' ,
1872
+ 'a|web/a.txt.sibling' : 'sibling' ,
1873
+ 'a|web/a.txt.new' : 'sibling' ,
1874
+ },
1875
+ outputs: {},
1876
+ resumeFrom: result,
1877
+ );
1941
1878
1942
1879
// And now try modifying the sibling to make sure that still works.
1943
1880
await testBuilders (
@@ -1946,11 +1883,9 @@ void main() {
1946
1883
'a|web/a.txt' : 'b' ,
1947
1884
'a|web/a.txt.sibling' : 'new!' ,
1948
1885
'a|web/a.txt.new' : 'sibling' ,
1949
- 'a|$assetGraphPath ' : result.readerWriter.testing.readBytes (
1950
- makeAssetId ('a|$assetGraphPath ' ),
1951
- ),
1952
1886
},
1953
1887
outputs: {'a|web/a.txt.new' : 'new!' },
1888
+ resumeFrom: result,
1954
1889
);
1955
1890
});
1956
1891
});
@@ -1986,13 +1921,9 @@ void main() {
1986
1921
'a|lib/a.source' : 'true' ,
1987
1922
}, status: BuildStatus .failure);
1988
1923
1989
- var serializedGraph = result.readerWriter.testing.readBytes (
1990
- makeAssetId ('a|$assetGraphPath ' ),
1991
- );
1992
-
1993
1924
await testBuilders (
1994
1925
builders,
1995
- {'a|lib/a.source' : 'false' , 'a|$ assetGraphPath ' : serializedGraph },
1926
+ {'a|lib/a.source' : 'false' },
1996
1927
outputs: {},
1997
1928
resumeFrom: result,
1998
1929
);
@@ -2070,30 +2001,22 @@ void main() {
2070
2001
),
2071
2002
),
2072
2003
];
2073
- final result = await testBuilders (builders, {
2004
+ var result = await testBuilders (builders, {
2074
2005
'a|web/a.source' : 'true' ,
2075
2006
}, status: BuildStatus .failure);
2076
2007
2077
- var serializedGraph = result.readerWriter.testing.readBytes (
2078
- makeAssetId ('a|$assetGraphPath ' ),
2079
- );
2080
-
2081
- await testBuilders (
2008
+ result = await testBuilders (
2082
2009
builders,
2083
- {'a|web/a.source' : 'false' , 'a|$ assetGraphPath ' : serializedGraph },
2010
+ {'a|web/a.source' : 'false' },
2084
2011
outputs: {'a|web/a.g1' : '' , 'a|web/a.g2' : '' , 'a|web/a.g3' : '' },
2085
2012
resumeFrom: result,
2086
2013
);
2087
2014
2088
- serializedGraph = result.readerWriter.testing.readBytes (
2089
- makeAssetId ('a|$assetGraphPath ' ),
2090
- );
2091
-
2092
2015
// Make sure if we mark the original node as a failure again, that we
2093
2016
// also mark all its primary outputs as failures.
2094
2017
await testBuilders (
2095
2018
builders,
2096
- {'a|web/a.source' : 'true' , 'a|$ assetGraphPath ' : serializedGraph },
2019
+ {'a|web/a.source' : 'true' },
2097
2020
outputs: {},
2098
2021
status: BuildStatus .failure,
2099
2022
resumeFrom: result,
0 commit comments