@@ -155,7 +155,6 @@ private void addDefaultOptionsToXCRunCommand( ArrayList<String> command ) {
155155 * @return the UUID for the process to keep working with
156156 * @throws XmlParseException in case the received plist xml file was erroneous
157157 */
158- @ SuppressWarnings ( "unchecked" )
159158 private String requestNotarization ( File notarizeFile ) {
160159
161160 ArrayList <String > command = new ArrayList <>();
@@ -173,16 +172,7 @@ private String requestNotarization( File notarizeFile ) {
173172
174173 try {
175174 Map <String , Object > plist = Plist .fromXml ( output );
176-
177- // Check for product errors during upload
178- List <String > productErrors = (List <String >)plist .computeIfPresent ( "product-errors" , ( String key , Object value ) -> ((List <Map <String , Object >>)value ).stream ().map ( entry -> entry .get ( "message" ) ).collect ( Collectors .toList () ) );
179- if ( productErrors != null && productErrors .size () > 0 ) {
180- throw new IllegalStateException ( String .join ( "\n " , productErrors ) );
181- }
182-
183- // Return the request UUID for later use
184- return (String )plist .computeIfPresent ( "notarization-upload" , ( String key , Object value ) -> ((Map <String , String >)value ).get ( "RequestUUID" ) );
185-
175+ return (String )plist .get ( "id" );
186176 } catch ( ClassCastException | XmlParseException e ) {
187177 task .getProject ().getLogger ().error ( "An error occured while checking the noraization response." );
188178 if ( !isDebugOutput () ) {
@@ -225,7 +215,6 @@ private void waitWithStatus( String status ) throws InterruptedException {
225215 * @param UUID the ID of the task to check against
226216 * @return true if the process was successful
227217 */
228- @ SuppressWarnings ( "unchecked" )
229218 private boolean waitForNotarization ( String UUID ) {
230219
231220 String output = "" ;
@@ -247,29 +236,33 @@ private boolean waitForNotarization( String UUID ) {
247236 output = exec ( true , error , command .toArray ( new String [command .size ()] ) );
248237 task .getProject ().getLogger ().debug ( output );
249238
250- Map <String , Object > plist = Plist .fromXml ( output );
251- Map <String , Object > info = (Map <String , Object >)plist .get ( "notarization-info" );
239+ Map <String , Object > info = Plist .fromXml ( output );
252240 if ( info == null ) {
253241 acceptedFailureCount --;
254242 lastErrors .add ( "There was no notarization information present. Was I too fast?" );
255243 waitWithStatus ( null );
256244 continue ;
257245 }
258246
259- String status = (String )info .get ( "Status " );
247+ String status = (String )info .get ( "status " );
260248 if ( status == null ) {
261249 acceptedFailureCount --;
262250 lastErrors .add ( "There was no Status present in the notarization information.\n \n " + output );
263251 waitWithStatus ( null );
264252 continue ;
265253 }
266254
267- if ( status .equalsIgnoreCase ( "success " ) ) {
255+ if ( status .equalsIgnoreCase ( "Accepted " ) ) {
268256 // This is what we have been waiting for!
269257 return true ;
270- } else if ( status .equalsIgnoreCase ( "invalid " ) ) {
258+ } else if ( status .equalsIgnoreCase ( "Invalid " ) ) {
271259 task .getProject ().getLogger ().error ( "The response status was 'invalid'. Please check the online logfile for problems:" );
260+ requestLogfile ( UUID );
261+ return false ;
262+ } else if ( status .equalsIgnoreCase ( "Rejected" ) ) {
263+ task .getProject ().getLogger ().error ( "The response status was 'rejected'. Please check the online logfile for problems:" );
272264 task .getProject ().getLogger ().error ( info .get ( "LogFileURL" ).toString () );
265+ requestLogfile ( UUID );
273266 return false ;
274267 }
275268
@@ -293,6 +286,28 @@ private boolean waitForNotarization( String UUID ) {
293286 throw new IllegalArgumentException ( String .join ( "\n " , lastErrors ) );
294287 }
295288
289+ /**
290+ * Request the logfile of the notarization
291+ * @param UUID the uuid of the process
292+ */
293+ private void requestLogfile ( String UUID ) {
294+
295+ ArrayList <String > command = new ArrayList <>();
296+ command .add ( "xcrun" );
297+ command .add ( "notarytool" );
298+ command .add ( "log" );
299+ addDefaultOptionsToXCRunCommand ( command );
300+ command .add ( UUID );
301+
302+ ByteArrayOutputStream error = new ByteArrayOutputStream ();
303+ String output = exec ( true , error , command .toArray ( new String [command .size ()] ) );
304+ if ( isDebugOutput () ) {
305+ task .getProject ().getLogger ().debug ( output );
306+ }
307+
308+ task .getProject ().getLogger ().info ( "Here comes the logfile of the notarization request" );
309+ task .getProject ().getLogger ().info ( output );
310+ }
296311 /**
297312 * This method checks for other processes running the notarization, since Apple does not allow multiple uploads simultaneously
298313 */
0 commit comments