// ĠCopyright Ġ 2 0 0 0 - 2 0 1 9 ĠJetBrains Ġs . r . o . ĠUse Ġof Ġthis Ġsource Ġcode Ġis Ġgoverned Ġby Ġthe ĠApache Ġ 2 . 0 Ġlicense Ġthat Ġcan Ġbe Ġfound Ġin Ġthe ĠLICENSE Ġfile . Ċ package Ġorg . jetbrains . index . stubs Ċ Ċ import Ġcom . intellij . openapi . application . Path Manager Ċ import Ġcom . intellij . openapi . application . Write Action Ċ import Ġcom . intellij . openapi . module . Module Ċ import Ġcom . intellij . openapi . project . Project Ċ import Ġcom . intellij . openapi . project . ex . Project Manager Ex Ċ import Ġcom . intellij . openapi . project Roots . Sdk Ċ import Ġcom . intellij . openapi . project Roots . impl . Sdk Configuration Util Ċ import Ġcom . intellij . openapi . roots . Order Root Type Ċ import Ġcom . intellij . openapi . vfs . Virtual File Ċ import Ġcom . intellij . test Framework . Test Application Manager Ċ import Ġcom . intellij . util . ui . UI Util Ċ import Ġjava . io . File Ċ import Ġkotlin . system . exit Process Ċ Ċ abstract Ġclass ĠProject Sdk Stub s Generator Ġ{ ĊĠ Ġopen Ġfun Ġcreate Stub s Generator ( stubs FilePath : ĠString ): ĠStub s Generator Ġ= ĠStub s Generator ("", Ġstub s FilePath ) ĊĊĠ Ġabstract Ġval Ġmodule TypeId : ĠString ĊĊĠ Ġabstract Ġfun Ġcreate Sdk Producer ( sdk Path : ĠString ): Ġ( Project , ĠModule ) Ġ-> ĠS dk ĊĊĠ Ġopen Ġval Ġroot : ĠString ? Ġ= ĠSystem . getenv (" SDK _ ROOT ") ĊĊĠ Ġprivate Ġval Ġstub s FileName Ġ= Ġ" sdk - stubs " ĊĊĠ Ġfun Ġbuild Stub s ( base Dir : ĠString ) Ġ{ ĊĠĠĠ ĠTest Application Manager . getInstance () ĊĠĠĠ Ġtry Ġ{ ĊĠĠĠĠĠ Ġfor Ġ( python Ġin ĠFile ( root ). list Files () !! ) Ġ{ ĊĠĠĠĠĠĠĠ Ġif Ġ( python . name . startsWith (". ")) Ġ{ ĊĠĠĠĠĠĠĠĠĠ Ġcontinue ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġindex Sdk And Store Serialized Stub s ("${ Path Manager . get Home Path () }/ python / testData / empty ", Ġpython . absolute Path , Ġ"$ base Dir /$ stubs FileName ") ĊĠĠĠĠĠ Ġ} ĊĠĠĠĠĠ Ġexit Process ( 0 ) ĊĠĠĠ Ġ} ĊĠĠĠ Ġcatch Ġ( e : ĠThrowable ) Ġ{ ĊĠĠĠĠĠ Ġe . printStackTrace () ĊĠĠĠĠĠ Ġexit Process ( 1 ) ĊĠĠĠ Ġ} ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun Ġindex Sdk And Store Serialized Stub s ( project Path : ĠString , Ġsdk Path : ĠString , Ġstub s FilePath : ĠString ) Ġ{ ĊĠĠĠ Ġval Ġpair Ġ= Ġopen Project With Sdk ( project Path , Ġmodule TypeId , Ġcreate Sdk Producer ( sdk Path )) ĊĠĠĠ Ġval Ġproject Ġ= Ġpair . first ĊĠĠĠ Ġval Ġsdk Ġ= Ġpair . second ĊĊĠĠĠ Ġtry Ġ{ ĊĠĠĠĠĠ Ġval Ġroots : ĠList < Virtual File > Ġ= Ġsdk !!. root Provider . get Files ( Order Root Type . CLASSES ). asList () ĊĠĠĠĠĠ Ġval Ġstub s Generator Ġ= Ġcreate Stub s Generator ( stubs FilePath ) ĊĠĠĠĠĠ Ġstub s Generator . build Stub s For Roots ( roots ) ĊĠĠĠ Ġ} ĊĠĠĠ Ġfinally Ġ{ ĊĠĠĠĠĠ ĠUI Util . invoke And Wait IfNeeded ( Runnable Ġ{ ĊĠĠĠĠĠĠĠ ĠProject Manager Ex . getInstance Ex (). force Close Project ( project ) ĊĠĠĠĠĠĠĠ ĠWrite Action . run < Throwable > Ġ{ ĊĠĠĠĠĠĠĠĠĠ ĠS dk Configuration Util . remove Sdk ( sdk !! ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠ Ġ}) ĊĠĠĠ Ġ} ĊĠ Ġ} Ċ }