File tree Expand file tree Collapse file tree 2 files changed +44
-1
lines changed
Expand file tree Collapse file tree 2 files changed +44
-1
lines changed Original file line number Diff line number Diff line change @@ -53,3 +53,46 @@ publishing {
5353tasks. withType(JavaCompile ) {
5454 options. encoding = ' UTF-8'
5555}
56+
57+ def originalFile = null ;
58+
59+ task backupCode {
60+ def file = file(' src/main/java/org/json/JSONParserConfiguration.java' )
61+ originalFile = file. text
62+ }
63+
64+ task firstTest {
65+
66+ }
67+
68+ task modifyCode {
69+ doLast {
70+ // Add your code modification logic here
71+ def file = file(' src/main/java/org/json/JSONParserConfiguration.java' )
72+ def text = file. text
73+ text = text. replaceAll(' oldCode' , ' newCode' )
74+ file. text = text
75+ }
76+ }
77+
78+ task compileModifiedCode (type : JavaCompile ) {
79+ source = sourceSets. main. java. srcDirs
80+ classpath = sourceSets. main. compileClasspath
81+ destinationDirectory = sourceSets. main. java. outputDir
82+ }
83+
84+ task secondTest {
85+
86+ }
87+
88+ task restoreCode {
89+ def file = file(' src/main/java/org/json/JSONParserConfiguration.java' )
90+ file. text = originalFile
91+ }
92+
93+ // and then add it to the task list
94+ backupCode. finalizedBy firstTest
95+ firstTest. finalizedBy modifyCode
96+ modifyCode. finalizedBy compileModifiedCode
97+ compileModifiedCode. finalizedBy secondTest
98+ secondTest. finalizedBy restoreCode
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ public class JSONParserConfiguration extends ParserConfiguration {
1515 public JSONParserConfiguration () {
1616 super ();
1717 this .overwriteDuplicateKey = false ;
18- // this.strictMode = true;
18+ // this.strictMode = true;
1919 }
2020
2121 /**
You can’t perform that action at this time.
0 commit comments